---
image: {{ $.ModuleName }}/{{ $.ImageName }}
fromImage: common/distroless
import:
  - image: common/pause
    add: /pause
    to: /pause
    before: setup
  - artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact
    add: /
    to: /usr/bin
    includePaths:
    - etcd
    - etcdctl
    before: setup
docker:
  ENTRYPOINT: ["/usr/bin/etcd"]
---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact
from: {{ $.Images.BASE_GOLANG_21_ALPINE_DEV }}
mount:
  - fromPath: ~/go-pkg-cache
    to: /go/pkg
shell:
  install:
    - export GOPROXY={{ $.GOPROXY }} GOOS=linux GOARCH=amd64 CGO_ENABLED=0
    - mkdir /src && cd /src
    - git clone -b v3.5.9 --depth 1 {{ $.SOURCE_REPO }}/etcd-io/etcd.git .
    - cd server && go build -ldflags="-s -w" -o /etcd . && cd ..
    - cd etcdctl && go build -ldflags="-s -w" -o /etcdctl . && cd ..
